import java.util.*;

public class _2023_10_10 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> arr = new ArrayList<>();
        arr.add(0);
        arr.add(1);
        int i = 2;
        while(true){
            int n1 = arr.get(i - 2);
            int n2 = arr.get(i - 1);
            if(n1 + n2 > 1e6){
                break;
            }
            arr.add(n1 + n2);
            i++;
        }
        System.out.println(arr.toString());
        int t = sc.nextInt();
        int l = 0;
        int r = arr.size() - 1;
        while(l <= r){
            int m = l + (r - l) / 2;
            if(arr.get(m) < t){
                l = m + 1;
            }else{
                r = m - 1;
            }
        }
        System.out.println();
        if(arr.get(l) == t){
            System.out.println(0);
            return;
        }

        arr.add(arr.get(l - 1) + arr.get(l - 2));
        System.out.println(l + "," + arr.size());
        int ans = Integer.MAX_VALUE;
        ans = Math.min(Math.abs(t - arr.get(l)), Math.abs(t - arr.get(l - 1)));
        System.out.println(ans);
    }

    public class Parenthesis {
        public boolean chkParenthesis(String A, int n) {
            char[] arr = A.toCharArray();
            int i = 0;
            Stack<Character> st = new Stack<>();
            for(i = 0; i < n; i++){
                if(arr[i] == '('){
                    st.push(arr[i]);
                }else if(arr[i] == ')'){
                    if(st.isEmpty()){
                        return false;
                    }else{
                        st.pop();
                    }
                }else{
                    return false;
                }
            }
            if(!st.isEmpty()){
                return false;
            }
            return true;
        }
    }
}
